package com.java.mapper;

import com.java.entity.Collec;
import com.java.entity.Malfunctions;
import com.java.entity.Orders;
import com.java.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Repository
public interface UserMapper {
    //登录
    User selectByNameAndPwd(@Param("userName") String userName, @Param("userPassword") String userPassword);

    //注册前的查询
    User registerPre(String userIdcard);
    User regiesterPree(String userName);

    //注册
    Boolean registerUser(User user);

    //忘记密码
    Boolean forgetPwd(@Param("userName")String userName, @Param("userIdcard")String userIdcard,@Param("userPassword")String userPassword);

    //管理员查看用户列表:分页、高级查询
    List<User> selectAll(@Param("startIndex") Integer startIndex,@Param("pageSize") Integer pageSize,@Param("username") String username);
    int record(@Param("username") String username);
    //管理员修改用户的登录权限
    void updatePermission(@Param("userId") String userId,@Param("permission") Boolean permission);
    User selectById(String userId);

    //房屋报修
    Boolean CallForRepairs(@Param("malfunctions") Malfunctions malfunctions);

    //查看收藏
    List<Collec> SelectAllCollecsById(@Param("userId")int userId);

    //删除收藏
    Boolean DeleteCollecById(@Param("userId")int userId,@Param("houseId")int houseId);

    //查看个人信息
    List<User> SelectUserByName(@Param("user")User user);

    //修改个人信息
    Boolean UpdateUser(@Param("user")User user);

    //查看订单
    List<Orders> selectOrdersById(@Param("userId")String userId);

    void updateUsertoAdmin(User user);
}
